<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
	<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" />
	<UsingTask TaskName="ModifyVersion" AssemblyFile="..\..\lib\VersionModifierTask\MSBuild.VersionModifierTask.dll" />
	
	<ItemGroup>
		<ZipFiles Include="$(PublishFolder)\*.dll" Exclude="*.zip" />
	</ItemGroup>
	
	<PropertyGroup>
		<SolutionConfiguration>Configuration=Release</SolutionConfiguration>
		<PublishFolder>..\..\Published</PublishFolder>
		<BinFolder>MSBuild.VersionModifierTask\bin</BinFolder>
		<BinFolderTests>MSBuild.VersionModifierTask.Tests\bin</BinFolderTests>
	</PropertyGroup>
	
	<Target Name="Clean">
		<RemoveDir Directories="$(PublishFolder);$(BinFolders);$(BinFolderTests)" ContinueOnError="true" />
		<MakeDir Directories="$(PublishFolder)" />
	</Target>
	
	<Target Name="Publish" DependsOnTargets="Clean">
		<SvnInfo LocalPath="$(MSBuildProjectDirectory)" ToolPath="c:\dev\CruiseControl.NET\Tools\SubVersion\bin\" >
			<Output TaskParameter="LastChangedRevision" PropertyName="LastChangedRevision" />
		</SvnInfo>
		
		<ModifyVersion AssemblyInfoPath="MSBuild.VersionModifierTask\properties\assemblyinfo.cs" 
						AssemblyVersionPattern="[-].[-].[$(LastChangedRevision)]" />
		
		<MSBuild 	Projects="MSBuild.VersionModifierTask.sln"
					Targets="Rebuild"           
					Properties="Configuration=Release" />
				
		<Copy SourceFiles="$(MSBuildProjectDirectory)\MSBuild.VersionModifierTask\bin\release\MSBuild.VersionModifierTask.dll"
            DestinationFiles="$(PublishFolder)\MSBuild.VersionModifierTask.dll" />
		
		<Zip Files="@(ZipFiles)" 
			WorkingDirectory="$(PublishFolder)" 
			ZipFileName="$(PublishFolder)\MSBuild.VersionModifierTask.zip" />
	</Target>
</Project>